import instance from '../utils/request'
// import axios from 'axios'

//获取所有历史记录
export const getHistoryListService = () => {

    return instance.post('/history/getAllHistoryRecord', null)

}

//删除历史记录
export const deleteHistoryService = (uid, id) => {

    const param = new URLSearchParams();
    param.append('UID', uid)
    param.append('id', id)

    return instance.post('/history/deleteHistoryRecord', param)

}

//根据UID获取历史记录
export const getHistoryListByUidService = (uid) => {

    const param = new URLSearchParams();
    param.append('uid', uid)

    return instance.post('/history/getAllHistoryRecordByUID', param)

}

//添加历史记录
export const addHistoryService = (historyInfo) => {

    // console.log("historyInfo:" + historyInfo.UID)

    const param = new URLSearchParams();
    for(let key in historyInfo){
        param.append(key,historyInfo[key])
    }

    // console.log("param" + param)

    return instance.post('/history/addHistoryRecord', param)

}